<template>
    <div class="row">
        <el-checkbox v-model="comp.enabled">{{ comp.__classname__ }}</el-checkbox>
        <el-button round size="small" :icon="Document" @click="gm.toConsole(comp)"></el-button>
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>Rotational</el-text>
        <el-checkbox v-model="comp.rotational" />
    </div>

    <div class="row-start">
        <el-text class="span-title" truncated>Scale</el-text>
        <el-input-number size="small" :controls="false" :step="0.1" v-model="Model.skewX">
            <template #suffix>
                <span>X</span>
            </template>
        </el-input-number>
        <el-input-number size="small" :controls="false" :step="0.1" v-model="Model.skewY">
            <template #suffix>
                <span>Y</span>
            </template>
        </el-input-number>
    </div>
</template>

<script lang="ts" setup>
import { Document } from '@element-plus/icons-vue'
import gm from './gm'

const props = defineProps<{
    comp: CCComponent,
    update: Number,
}>()

class Model{
    static get comp() {
        return props.comp
    }

    static get skewX() {
        return this.comp.skew.x
    }

    static set skewX(value: number) {
        const ori = this.comp.skew
        ori.x = value
        this.comp.skew = ori
    }

    static get skewY() {
        return this.comp.skew.y
    }

    static set skewY(value: number) {
        const ori = this.comp.skew
        ori.y = value
        this.comp.skew = ori
    }
}
</script>